package org.java.io;

import java.io.File;

/**
 * Java 路径测试
 * Created by Administrator on 2016/12/8.
 */
public class PathTest {

    public static void main(String[] args) {
        // 获取Java 项目根目录
        //String rootPath = System.getProperty("user.dir");
        //System.out.println(rootPath);

        // 当前的classpath的绝对URI路径
        //String classpath = new PathTest().getClass().getResource("/").getPath();
        //System.out.println(classpath.substring(1, classpath.length()));

        // 测试获取properties文件
        getProperties();
    }

    /**
     * 测试获取properties文件
     * */
    public static void getProperties(){
        File file3 = new File(PathTest.class.getResource("/resource/jdbc.properties").getFile());
        System.out.println(file3.getName());
    }
}
